﻿@model GameCode.Models.Admin.FriendLinkEditModel
@{
    ViewBag.Title = "游戏特权 - 友情链接";
    Model.Caption = Model.IsNew ? "新增友情链接" : "编辑友情链接";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<script type="text/javascript">
    var hasRun = false;
    var i = 0;

    $(document).live('pageshow', function (event, ui) {
        i++;
        var isReturn = $(".isReturn").val();
        if (isReturn == 'true' && i == 1) {
            return;
        }
        if (hasRun) {
            return;
        }

        $("#uploadify").uploadify({
            'uploader': '@Url.Content("~/Scripts/uploadify/uploadify.swf")',
            'script': '@Url.Content("~/Admin/UploadHandle")',
            'cancelImg': '@Url.Content("~/Scripts/uploadify/cancel.png")',
            'folder': 'upload_files',
            'queueID': 'fileQueue',
            'auto': false,
            'multi': false,
            'wmode': 'transparent',
            'sizeLimit': 10737418240,
            'onComplete': function (e, queueId, fileObj, response, data) {
                $(".input_url").val("/upload_files/" + fileObj.name);
                $("#urll").val("/upload_files/" + fileObj.name);
                parent.reloadImg("/upload_files/" + fileObj.name);
            },
            'onError': function (a, b, c, d) {
                if (d.status == 404)
                    alert('Could not find upload script. Use a path relative to: ' + '<?= getcwd() ?>');
                else if (d.type === "HTTP")
                    alert('error ' + d.type + ": " + d.status);
                else if (d.type === "File Size")
                    alert(c.name + ' ' + d.type + ' Limit: ' + Math.round(d.sizeLimit / 1024) + 'KB');
                else
                    alert('error ' + d.type + ": " + d.text);
            }
        });
        hasRun = true;
    });
</script>
@using (Html.BeginForm(new { act = "submit" }))
{
    @Html.HiddenFor(m => m.IsNew)
    @Html.HiddenFor(m => m.ID)
    <div class="ui-bar ui-bar-a">
        编辑
    </div>
    <div class="ui-body ui-body-a">
        <div data-role="fieldcontain">
            @Html.LabelFor(m => m.Name)
            @Html.TextBoxFor(m => m.Name, new Dict() { "data-mini:true" })
            @Html.ValidationMessageFor(m => m.Name, new { style = "color:Red" })
        </div>
        <div data-role="fieldcontain">
            @Html.LabelFor(m => m.ImageLink)
            @Html.TextBoxFor(m => m.ImageLink, new Dict() { "data-mini:true", "class:input_url" })
            @Html.ValidationMessageFor(m => m.ImageLink, new { style = "color:Red" })
        </div>
        <div data-role="fieldcontain">
            @Html.Partial("Upload")
        </div>
        <div data-role="fieldcontain">
            @Html.LabelFor(m => m.Link)
            @Html.TextBoxFor(m => m.Link, new Dict() { "data-mini:true" })
            @Html.ValidationMessageFor(m => m.Link, new { style = "color:Red" })
        </div>
        <div data-role="fieldcontain">
            @Html.LabelFor(m => m.Seq)
            @Html.TextBoxFor(m => m.Seq, new Dict() { "data-mini:true" })
            @Html.ValidationMessageFor(m => m.Seq, new { style = "color:Red" })
        </div>
        <input type="submit" value="确认"  data-inline="true" data-mini="true"  />
    </div>
}